<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>png++: pixel_buffer.hpp Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />



</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">png++
   &#160;<span id="projectnumber">0.2.1</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.6.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="headertitle">
<div class="title">pixel_buffer.hpp</div>  </div>
</div><!--header-->
<div class="contents">
<a href="pixel__buffer_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> * Copyright (C) 2007,2008   Alex Shulgin</span>
<a name="l00003"></a>00003 <span class="comment"> *</span>
<a name="l00004"></a>00004 <span class="comment"> * This file is part of png++ the C++ wrapper for libpng.  PNG++ is free</span>
<a name="l00005"></a>00005 <span class="comment"> * software; the exact copying conditions are as follows:</span>
<a name="l00006"></a>00006 <span class="comment"> *</span>
<a name="l00007"></a>00007 <span class="comment"> * Redistribution and use in source and binary forms, with or without</span>
<a name="l00008"></a>00008 <span class="comment"> * modification, are permitted provided that the following conditions are met:</span>
<a name="l00009"></a>00009 <span class="comment"> *</span>
<a name="l00010"></a>00010 <span class="comment"> * 1. Redistributions of source code must retain the above copyright notice,</span>
<a name="l00011"></a>00011 <span class="comment"> * this list of conditions and the following disclaimer.</span>
<a name="l00012"></a>00012 <span class="comment"> *</span>
<a name="l00013"></a>00013 <span class="comment"> * 2. Redistributions in binary form must reproduce the above copyright</span>
<a name="l00014"></a>00014 <span class="comment"> * notice, this list of conditions and the following disclaimer in the</span>
<a name="l00015"></a>00015 <span class="comment"> * documentation and/or other materials provided with the distribution.</span>
<a name="l00016"></a>00016 <span class="comment"> *</span>
<a name="l00017"></a>00017 <span class="comment"> * 3. The name of the author may not be used to endorse or promote products</span>
<a name="l00018"></a>00018 <span class="comment"> * derived from this software without specific prior written permission.</span>
<a name="l00019"></a>00019 <span class="comment"> *</span>
<a name="l00020"></a>00020 <span class="comment"> * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS&#39;&#39; AND ANY EXPRESS OR</span>
<a name="l00021"></a>00021 <span class="comment"> * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES</span>
<a name="l00022"></a>00022 <span class="comment"> * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN</span>
<a name="l00023"></a>00023 <span class="comment"> * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,</span>
<a name="l00024"></a>00024 <span class="comment"> * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED</span>
<a name="l00025"></a>00025 <span class="comment"> * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR</span>
<a name="l00026"></a>00026 <span class="comment"> * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF</span>
<a name="l00027"></a>00027 <span class="comment"> * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING</span>
<a name="l00028"></a>00028 <span class="comment"> * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS</span>
<a name="l00029"></a>00029 <span class="comment"> * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span>
<a name="l00030"></a>00030 <span class="comment"> */</span>
<a name="l00031"></a>00031 <span class="preprocessor">#ifndef PNGPP_PIXEL_BUFFER_HPP_INCLUDED</span>
<a name="l00032"></a>00032 <span class="preprocessor"></span><span class="preprocessor">#define PNGPP_PIXEL_BUFFER_HPP_INCLUDED</span>
<a name="l00033"></a>00033 <span class="preprocessor"></span>
<a name="l00034"></a>00034 <span class="preprocessor">#include &lt;cassert&gt;</span>
<a name="l00035"></a>00035 <span class="preprocessor">#include &lt;cstddef&gt;</span>
<a name="l00036"></a>00036 <span class="preprocessor">#include &lt;stdexcept&gt;</span>
<a name="l00037"></a>00037 <span class="preprocessor">#include &lt;vector&gt;</span>
<a name="l00038"></a>00038 
<a name="l00039"></a>00039 <span class="preprocessor">#include &quot;<a class="code" href="packed__pixel_8hpp.html">packed_pixel.hpp</a>&quot;</span>
<a name="l00040"></a>00040 <span class="preprocessor">#include &quot;<a class="code" href="gray__pixel_8hpp.html">gray_pixel.hpp</a>&quot;</span>
<a name="l00041"></a>00041 <span class="preprocessor">#include &quot;<a class="code" href="index__pixel_8hpp.html">index_pixel.hpp</a>&quot;</span>
<a name="l00042"></a>00042 
<a name="l00043"></a>00043 <span class="keyword">namespace </span>png
<a name="l00044"></a>00044 {
<a name="l00045"></a>00045 
<a name="l00053"></a>00053     <span class="keyword">template</span>&lt; <span class="keyword">typename</span> row &gt; <span class="keyword">class </span>row_traits;
<a name="l00054"></a>00054 
<a name="l00058"></a>00058     <span class="keyword">template</span>&lt; <span class="keyword">typename</span> pixel,
<a name="l00059"></a>00059               <span class="keyword">typename</span> row,
<a name="l00060"></a>00060               <span class="keyword">class </span>traits = row_traits&lt; row &gt; &gt;
<a name="l00061"></a><a class="code" href="classpng_1_1basic__pixel__buffer.html">00061</a>     <span class="keyword">class </span><a class="code" href="classpng_1_1basic__pixel__buffer.html" title="The basic class template to represent image pixel data.">basic_pixel_buffer</a>
<a name="l00062"></a>00062     {
<a name="l00063"></a>00063     <span class="keyword">public</span>:
<a name="l00067"></a><a class="code" href="classpng_1_1basic__pixel__buffer.html#a9f613598fdbb2097bb6e2106430a3fcf">00067</a>         <span class="keyword">typedef</span> row <a class="code" href="classpng_1_1basic__pixel__buffer.html#a9f613598fdbb2097bb6e2106430a3fcf" title="A row of pixel data.">row_type</a>;
<a name="l00068"></a><a class="code" href="classpng_1_1basic__pixel__buffer.html#a6ec7bb7770cfcf6c6327647536ace0bb">00068</a>         <span class="keyword">typedef</span> traits <a class="code" href="classpng_1_1basic__pixel__buffer.html#a6ec7bb7770cfcf6c6327647536ace0bb">row_traits</a>;
<a name="l00069"></a>00069 
<a name="l00073"></a><a class="code" href="classpng_1_1basic__pixel__buffer.html#a9505d0a3979d58e6098ee06699d008a3">00073</a>         <a class="code" href="classpng_1_1basic__pixel__buffer.html#a9505d0a3979d58e6098ee06699d008a3" title="Constructs an empty 0x0 pixel buffer object.">basic_pixel_buffer</a>()
<a name="l00074"></a>00074             : <a class="code" href="classpng_1_1basic__pixel__buffer.html#a993f85bf0369c9b0890ddac71c43b182">m_width</a>(0),
<a name="l00075"></a>00075               <a class="code" href="classpng_1_1basic__pixel__buffer.html#a2ff9bf219d10a34be11bb2310646db4d">m_height</a>(0)
<a name="l00076"></a>00076         {
<a name="l00077"></a>00077         }
<a name="l00078"></a>00078 
<a name="l00082"></a><a class="code" href="classpng_1_1basic__pixel__buffer.html#a69f4e7a246f7992ff024e209b0e59030">00082</a>         <a class="code" href="classpng_1_1basic__pixel__buffer.html#a9505d0a3979d58e6098ee06699d008a3" title="Constructs an empty 0x0 pixel buffer object.">basic_pixel_buffer</a>(<span class="keywordtype">size_t</span> width, <span class="keywordtype">size_t</span> height)
<a name="l00083"></a>00083             : <a class="code" href="classpng_1_1basic__pixel__buffer.html#a993f85bf0369c9b0890ddac71c43b182">m_width</a>(0),
<a name="l00084"></a>00084               <a class="code" href="classpng_1_1basic__pixel__buffer.html#a2ff9bf219d10a34be11bb2310646db4d">m_height</a>(0)
<a name="l00085"></a>00085         {
<a name="l00086"></a>00086             <a class="code" href="classpng_1_1basic__pixel__buffer.html#a24464e17d19d43102b4ea1ba1e8f75d2" title="Resizes the pixel buffer.">resize</a>(width, height);
<a name="l00087"></a>00087         }
<a name="l00088"></a>00088 
<a name="l00089"></a><a class="code" href="classpng_1_1basic__pixel__buffer.html#a08653f32687d377b91c44848f7a4a7e5">00089</a>         <span class="keywordtype">size_t</span> <a class="code" href="classpng_1_1basic__pixel__buffer.html#a08653f32687d377b91c44848f7a4a7e5">get_width</a>()<span class="keyword"> const</span>
<a name="l00090"></a>00090 <span class="keyword">        </span>{
<a name="l00091"></a>00091             <span class="keywordflow">return</span> <a class="code" href="classpng_1_1basic__pixel__buffer.html#a993f85bf0369c9b0890ddac71c43b182">m_width</a>;
<a name="l00092"></a>00092         }
<a name="l00093"></a>00093 
<a name="l00094"></a><a class="code" href="classpng_1_1basic__pixel__buffer.html#ac358ea2cde969c8a356983dd0e00d84d">00094</a>         <span class="keywordtype">size_t</span> <a class="code" href="classpng_1_1basic__pixel__buffer.html#ac358ea2cde969c8a356983dd0e00d84d">get_height</a>()<span class="keyword"> const</span>
<a name="l00095"></a>00095 <span class="keyword">            </span>{
<a name="l00096"></a>00096             <span class="keywordflow">return</span> <a class="code" href="classpng_1_1basic__pixel__buffer.html#a2ff9bf219d10a34be11bb2310646db4d">m_height</a>;
<a name="l00097"></a>00097             }
<a name="l00098"></a>00098 
<a name="l00105"></a><a class="code" href="classpng_1_1basic__pixel__buffer.html#a24464e17d19d43102b4ea1ba1e8f75d2">00105</a>         <span class="keywordtype">void</span> <a class="code" href="classpng_1_1basic__pixel__buffer.html#a24464e17d19d43102b4ea1ba1e8f75d2" title="Resizes the pixel buffer.">resize</a>(<span class="keywordtype">size_t</span> width, <span class="keywordtype">size_t</span> height)
<a name="l00106"></a>00106         {
<a name="l00107"></a>00107             <a class="code" href="classpng_1_1basic__pixel__buffer.html#a993f85bf0369c9b0890ddac71c43b182">m_width</a> = width;
<a name="l00108"></a>00108             <a class="code" href="classpng_1_1basic__pixel__buffer.html#a2ff9bf219d10a34be11bb2310646db4d">m_height</a> = height;
<a name="l00109"></a>00109             <a class="code" href="classpng_1_1basic__pixel__buffer.html#a88281bf95ea7868bdea9104de64f83fe">m_rows</a>.resize(height);
<a name="l00110"></a>00110             <span class="keywordflow">for</span> (<span class="keyword">typename</span> row_vec::iterator r = <a class="code" href="classpng_1_1basic__pixel__buffer.html#a88281bf95ea7868bdea9104de64f83fe">m_rows</a>.begin();
<a name="l00111"></a>00111                  r != <a class="code" href="classpng_1_1basic__pixel__buffer.html#a88281bf95ea7868bdea9104de64f83fe">m_rows</a>.end();
<a name="l00112"></a>00112                  ++r)
<a name="l00113"></a>00113             {
<a name="l00114"></a>00114                 r-&gt;resize(width);
<a name="l00115"></a>00115             }
<a name="l00116"></a>00116         }
<a name="l00117"></a>00117 
<a name="l00126"></a><a class="code" href="classpng_1_1basic__pixel__buffer.html#a4ecc5f4afb12d5d07b8df2d77707e6b2">00126</a>         <a class="code" href="classpng_1_1packed__pixel__row.html" title="The packed pixel row class template.">row_type</a>&amp; <a class="code" href="classpng_1_1basic__pixel__buffer.html#a4ecc5f4afb12d5d07b8df2d77707e6b2" title="Returns a reference to the row of image data at specified index.">get_row</a>(<span class="keywordtype">size_t</span> index)
<a name="l00127"></a>00127         {
<a name="l00128"></a>00128             <span class="keywordflow">return</span> <a class="code" href="classpng_1_1basic__pixel__buffer.html#a88281bf95ea7868bdea9104de64f83fe">m_rows</a>.at(index);
<a name="l00129"></a>00129         }
<a name="l00130"></a>00130 
<a name="l00137"></a><a class="code" href="classpng_1_1basic__pixel__buffer.html#a574c8e34ad45d5c8da882226d345663a">00137</a>         <a class="code" href="classpng_1_1packed__pixel__row.html" title="The packed pixel row class template.">row_type</a> <span class="keyword">const</span>&amp; <a class="code" href="classpng_1_1basic__pixel__buffer.html#a4ecc5f4afb12d5d07b8df2d77707e6b2" title="Returns a reference to the row of image data at specified index.">get_row</a>(<span class="keywordtype">size_t</span> index)<span class="keyword"> const</span>
<a name="l00138"></a>00138 <span class="keyword">        </span>{
<a name="l00139"></a>00139             <span class="keywordflow">return</span> <a class="code" href="classpng_1_1basic__pixel__buffer.html#a88281bf95ea7868bdea9104de64f83fe">m_rows</a>.at(index);
<a name="l00140"></a>00140         }
<a name="l00141"></a>00141 
<a name="l00145"></a><a class="code" href="classpng_1_1basic__pixel__buffer.html#ab4fdc263c1db7bcb67487004f1d09962">00145</a>         <a class="code" href="classpng_1_1packed__pixel__row.html" title="The packed pixel row class template.">row_type</a>&amp; <a class="code" href="classpng_1_1basic__pixel__buffer.html#ab4fdc263c1db7bcb67487004f1d09962" title="The non-checking version of get_row() method.">operator[]</a>(<span class="keywordtype">size_t</span> index)
<a name="l00146"></a>00146         {
<a name="l00147"></a>00147             <span class="keywordflow">return</span> <a class="code" href="classpng_1_1basic__pixel__buffer.html#a88281bf95ea7868bdea9104de64f83fe">m_rows</a>[index];
<a name="l00148"></a>00148         }
<a name="l00149"></a>00149 
<a name="l00153"></a><a class="code" href="classpng_1_1basic__pixel__buffer.html#ac03b48308117305c4bda0ee33e6c1fda">00153</a>         <a class="code" href="classpng_1_1packed__pixel__row.html" title="The packed pixel row class template.">row_type</a> <span class="keyword">const</span>&amp; <a class="code" href="classpng_1_1basic__pixel__buffer.html#ab4fdc263c1db7bcb67487004f1d09962" title="The non-checking version of get_row() method.">operator[]</a>(<span class="keywordtype">size_t</span> index)<span class="keyword"> const</span>
<a name="l00154"></a>00154 <span class="keyword">        </span>{
<a name="l00155"></a>00155             <span class="keywordflow">return</span> <a class="code" href="classpng_1_1basic__pixel__buffer.html#a88281bf95ea7868bdea9104de64f83fe">m_rows</a>[index];
<a name="l00156"></a>00156         }
<a name="l00157"></a>00157 
<a name="l00161"></a><a class="code" href="classpng_1_1basic__pixel__buffer.html#a8ab920a182c081600aaca81a7e889d6f">00161</a>         <span class="keywordtype">void</span> <a class="code" href="classpng_1_1basic__pixel__buffer.html#a8ab920a182c081600aaca81a7e889d6f" title="Replaces the row at specified index.">put_row</a>(<span class="keywordtype">size_t</span> index, <a class="code" href="classpng_1_1packed__pixel__row.html" title="The packed pixel row class template.">row_type</a> <span class="keyword">const</span>&amp; r)
<a name="l00162"></a>00162         {
<a name="l00163"></a>00163             assert(r.<a class="code" href="classpng_1_1packed__pixel__row.html#a25a90dc43dbe6fe8770fcb30f0683775">size</a>() == <a class="code" href="classpng_1_1basic__pixel__buffer.html#a993f85bf0369c9b0890ddac71c43b182">m_width</a>);
<a name="l00164"></a>00164             <a class="code" href="classpng_1_1basic__pixel__buffer.html#a88281bf95ea7868bdea9104de64f83fe">m_rows</a>.at(index) = r;
<a name="l00165"></a>00165         }
<a name="l00166"></a>00166 
<a name="l00170"></a><a class="code" href="classpng_1_1basic__pixel__buffer.html#a066630b24578f29cc9f380b026fe4a66">00170</a>         pixel <a class="code" href="classpng_1_1basic__pixel__buffer.html#a066630b24578f29cc9f380b026fe4a66" title="Returns a pixel at (x,y) position.">get_pixel</a>(<span class="keywordtype">size_t</span> x, <span class="keywordtype">size_t</span> y)<span class="keyword"> const</span>
<a name="l00171"></a>00171 <span class="keyword">        </span>{
<a name="l00172"></a>00172             <span class="keywordflow">return</span> <a class="code" href="classpng_1_1basic__pixel__buffer.html#a4ecc5f4afb12d5d07b8df2d77707e6b2" title="Returns a reference to the row of image data at specified index.">get_row</a>(y).at(x);
<a name="l00173"></a>00173         }
<a name="l00174"></a>00174 
<a name="l00178"></a><a class="code" href="classpng_1_1basic__pixel__buffer.html#a66bcef0d0f879c0c2cba962fff72f935">00178</a>         <span class="keywordtype">void</span> <a class="code" href="classpng_1_1basic__pixel__buffer.html#a66bcef0d0f879c0c2cba962fff72f935" title="Replaces a pixel at (x,y) position.">set_pixel</a>(<span class="keywordtype">size_t</span> x, <span class="keywordtype">size_t</span> y, pixel p)
<a name="l00179"></a>00179         {
<a name="l00180"></a>00180             <a class="code" href="classpng_1_1basic__pixel__buffer.html#a4ecc5f4afb12d5d07b8df2d77707e6b2" title="Returns a reference to the row of image data at specified index.">get_row</a>(y).at(x) = p;
<a name="l00181"></a>00181         }
<a name="l00182"></a>00182 
<a name="l00183"></a>00183     <span class="keyword">protected</span>:
<a name="l00184"></a><a class="code" href="classpng_1_1basic__pixel__buffer.html#a993f85bf0369c9b0890ddac71c43b182">00184</a>         <span class="keywordtype">size_t</span> <a class="code" href="classpng_1_1basic__pixel__buffer.html#a993f85bf0369c9b0890ddac71c43b182">m_width</a>;
<a name="l00185"></a><a class="code" href="classpng_1_1basic__pixel__buffer.html#a2ff9bf219d10a34be11bb2310646db4d">00185</a>         <span class="keywordtype">size_t</span> <a class="code" href="classpng_1_1basic__pixel__buffer.html#a2ff9bf219d10a34be11bb2310646db4d">m_height</a>;
<a name="l00186"></a><a class="code" href="classpng_1_1basic__pixel__buffer.html#a2bf3f5de8ee32110b4bad6706f1aaebd">00186</a>         <span class="keyword">typedef</span> std::vector&lt; row_type &gt; <a class="code" href="classpng_1_1basic__pixel__buffer.html#a2bf3f5de8ee32110b4bad6706f1aaebd">row_vec</a>;
<a name="l00187"></a><a class="code" href="classpng_1_1basic__pixel__buffer.html#a88281bf95ea7868bdea9104de64f83fe">00187</a>         <a class="code" href="classpng_1_1basic__pixel__buffer.html#a2bf3f5de8ee32110b4bad6706f1aaebd">row_vec</a> <a class="code" href="classpng_1_1basic__pixel__buffer.html#a88281bf95ea7868bdea9104de64f83fe">m_rows</a>;
<a name="l00188"></a>00188     };
<a name="l00189"></a>00189 
<a name="l00193"></a>00193     <span class="keyword">template</span>&lt; <span class="keyword">typename</span> pixel &gt;
<a name="l00194"></a><a class="code" href="classpng_1_1row__traits_3_01std_1_1vector_3_01pixel_01_4_01_4.html">00194</a>     <span class="keyword">class </span>row_traits&lt; std::vector&lt; pixel &gt; &gt;
<a name="l00195"></a>00195     {
<a name="l00196"></a>00196     <span class="keyword">public</span>:
<a name="l00200"></a><a class="code" href="classpng_1_1row__traits_3_01std_1_1vector_3_01pixel_01_4_01_4.html#a91a6fc7e066235eb28f6394bb3e8eddf">00200</a>         <span class="keyword">static</span> pixel* get_data(std::vector&lt; pixel &gt;&amp; vec)
<a name="l00201"></a>00201         {
<a name="l00202"></a>00202             assert(vec.size());
<a name="l00203"></a>00203             <span class="keywordflow">return</span> &amp; vec[0];
<a name="l00204"></a>00204         }
<a name="l00205"></a>00205     };
<a name="l00206"></a>00206 
<a name="l00210"></a>00210     <span class="keyword">template</span>&lt; <span class="keyword">typename</span> pixel &gt;
<a name="l00211"></a><a class="code" href="classpng_1_1pixel__buffer.html">00211</a>     <span class="keyword">class </span><a class="code" href="classpng_1_1pixel__buffer.html">pixel_buffer</a>
<a name="l00212"></a>00212         : <span class="keyword">public</span> <a class="code" href="classpng_1_1basic__pixel__buffer.html" title="The basic class template to represent image pixel data.">basic_pixel_buffer</a>&lt; pixel, std::vector&lt; pixel &gt; &gt;
<a name="l00213"></a>00213     {
<a name="l00214"></a>00214     <span class="keyword">public</span>:
<a name="l00215"></a><a class="code" href="classpng_1_1pixel__buffer.html#a2f6ce8ebf423720f5956630b1fa930ac">00215</a>         <a class="code" href="classpng_1_1pixel__buffer.html#a2f6ce8ebf423720f5956630b1fa930ac">pixel_buffer</a>()
<a name="l00216"></a>00216         {
<a name="l00217"></a>00217         }
<a name="l00218"></a>00218 
<a name="l00219"></a><a class="code" href="classpng_1_1pixel__buffer.html#ac13e6d1e998f3591e85338cc020bbf8e">00219</a>         <a class="code" href="classpng_1_1pixel__buffer.html#a2f6ce8ebf423720f5956630b1fa930ac">pixel_buffer</a>(<span class="keywordtype">size_t</span> width, <span class="keywordtype">size_t</span> height)
<a name="l00220"></a>00220             : <a class="code" href="classpng_1_1basic__pixel__buffer.html" title="The basic class template to represent image pixel data.">basic_pixel_buffer</a>&lt; pixel, std::vector&lt; pixel &gt; &gt;(width, height)
<a name="l00221"></a>00221         {
<a name="l00222"></a>00222         }
<a name="l00223"></a>00223     };
<a name="l00224"></a>00224 
<a name="l00225"></a>00225     <span class="keyword">namespace </span>detail
<a name="l00226"></a>00226     {
<a name="l00227"></a>00227 
<a name="l00228"></a>00228         <span class="keyword">template</span>&lt; <span class="keyword">class</span> pixel, <span class="keyword">typename</span> reference &gt;
<a name="l00229"></a><a class="code" href="classpng_1_1detail_1_1basic__packed__pixel__proxy.html">00229</a>         <span class="keyword">class </span><a class="code" href="classpng_1_1detail_1_1basic__packed__pixel__proxy.html">basic_packed_pixel_proxy</a>
<a name="l00230"></a>00230         {
<a name="l00231"></a>00231         <span class="keyword">public</span>:
<a name="l00232"></a><a class="code" href="classpng_1_1detail_1_1basic__packed__pixel__proxy.html#a1dd0c6c7efb56afc946f296e111bd5a3">00232</a>             <span class="keyword">explicit</span> <a class="code" href="classpng_1_1detail_1_1basic__packed__pixel__proxy.html#a1dd0c6c7efb56afc946f296e111bd5a3">basic_packed_pixel_proxy</a>(reference ref)
<a name="l00233"></a>00233                 : <a class="code" href="classpng_1_1detail_1_1basic__packed__pixel__proxy.html#a0b47ef1e993ff1a0b0cd036a4775ca6a">m_ref</a>(ref),
<a name="l00234"></a>00234                   <a class="code" href="classpng_1_1detail_1_1basic__packed__pixel__proxy.html#afec0eb6d13500f31e5300fcb6f5c9e8b">m_shift</a>(0)
<a name="l00235"></a>00235             {
<a name="l00236"></a>00236             }
<a name="l00237"></a>00237 
<a name="l00238"></a><a class="code" href="classpng_1_1detail_1_1basic__packed__pixel__proxy.html#adbaf91b246b90851bbb4ba922edcf8c9">00238</a>             <a class="code" href="classpng_1_1detail_1_1basic__packed__pixel__proxy.html#a1dd0c6c7efb56afc946f296e111bd5a3">basic_packed_pixel_proxy</a>(reference ref, <span class="keywordtype">size_t</span> index)
<a name="l00239"></a>00239                 : <a class="code" href="classpng_1_1detail_1_1basic__packed__pixel__proxy.html#a0b47ef1e993ff1a0b0cd036a4775ca6a">m_ref</a>(ref),
<a name="l00240"></a>00240                   <a class="code" href="classpng_1_1detail_1_1basic__packed__pixel__proxy.html#afec0eb6d13500f31e5300fcb6f5c9e8b">m_shift</a>(<a class="code" href="classpng_1_1detail_1_1basic__packed__pixel__proxy.html#aa6282173b265c754796982608f199eee">get_shift</a>(index))
<a name="l00241"></a>00241             {
<a name="l00242"></a>00242             }
<a name="l00243"></a>00243 
<a name="l00244"></a><a class="code" href="classpng_1_1detail_1_1basic__packed__pixel__proxy.html#a2df862f47fa4f1d723be43844050f223">00244</a>             <a class="code" href="classpng_1_1detail_1_1basic__packed__pixel__proxy.html#a2df862f47fa4f1d723be43844050f223">operator pixel</a>()<span class="keyword"> const</span>
<a name="l00245"></a>00245 <span class="keyword">            </span>{
<a name="l00246"></a>00246                 <span class="keywordflow">return</span> pixel((<a class="code" href="classpng_1_1detail_1_1basic__packed__pixel__proxy.html#a0b47ef1e993ff1a0b0cd036a4775ca6a">m_ref</a> &gt;&gt; <a class="code" href="classpng_1_1detail_1_1basic__packed__pixel__proxy.html#afec0eb6d13500f31e5300fcb6f5c9e8b">m_shift</a>) &amp; pixel::get_bit_mask());
<a name="l00247"></a>00247             }
<a name="l00248"></a>00248 
<a name="l00249"></a>00249         <span class="keyword">protected</span>:
<a name="l00250"></a>00250             <span class="comment">/*</span>
<a name="l00251"></a>00251 <span class="comment">             * bits: . .   .</span>
<a name="l00252"></a>00252 <span class="comment">             *    1: 7 6 5 4 3 2 1 0</span>
<a name="l00253"></a>00253 <span class="comment">             *    2:   6   4   2   0</span>
<a name="l00254"></a>00254 <span class="comment">             *    4:       4       0</span>
<a name="l00255"></a>00255 <span class="comment">             */</span>
<a name="l00256"></a><a class="code" href="classpng_1_1detail_1_1basic__packed__pixel__proxy.html#aa6282173b265c754796982608f199eee">00256</a>             <span class="keyword">static</span> <span class="keywordtype">size_t</span> <a class="code" href="classpng_1_1detail_1_1basic__packed__pixel__proxy.html#aa6282173b265c754796982608f199eee">get_shift</a>(<span class="keywordtype">size_t</span> index)
<a name="l00257"></a>00257             {
<a name="l00258"></a>00258                 <span class="keywordtype">size_t</span> <span class="keyword">const</span> bits = pixel::get_bit_depth();
<a name="l00259"></a>00259                 <span class="keywordflow">return</span> (8 - bits) - (index % <a class="code" href="classpng_1_1detail_1_1basic__packed__pixel__proxy.html#a2dddf0681e47f2358aed4ba3944566c4">get_pixels_per_byte</a>()) * bits;
<a name="l00260"></a>00260             }
<a name="l00261"></a>00261 
<a name="l00262"></a><a class="code" href="classpng_1_1detail_1_1basic__packed__pixel__proxy.html#a2dddf0681e47f2358aed4ba3944566c4">00262</a>             <span class="keyword">static</span> <span class="keywordtype">size_t</span> <a class="code" href="classpng_1_1detail_1_1basic__packed__pixel__proxy.html#a2dddf0681e47f2358aed4ba3944566c4">get_pixels_per_byte</a>()
<a name="l00263"></a>00263             {
<a name="l00264"></a>00264                 <span class="keywordflow">return</span> 8 / pixel::get_bit_depth();
<a name="l00265"></a>00265             }
<a name="l00266"></a>00266 
<a name="l00267"></a><a class="code" href="classpng_1_1detail_1_1basic__packed__pixel__proxy.html#a0b47ef1e993ff1a0b0cd036a4775ca6a">00267</a>             reference <a class="code" href="classpng_1_1detail_1_1basic__packed__pixel__proxy.html#a0b47ef1e993ff1a0b0cd036a4775ca6a">m_ref</a>;
<a name="l00268"></a><a class="code" href="classpng_1_1detail_1_1basic__packed__pixel__proxy.html#afec0eb6d13500f31e5300fcb6f5c9e8b">00268</a>             <span class="keywordtype">size_t</span> <a class="code" href="classpng_1_1detail_1_1basic__packed__pixel__proxy.html#afec0eb6d13500f31e5300fcb6f5c9e8b">m_shift</a>;
<a name="l00269"></a>00269         };
<a name="l00270"></a>00270 
<a name="l00271"></a>00271         <span class="keyword">template</span>&lt; <span class="keyword">class</span> pixel &gt;
<a name="l00272"></a><a class="code" href="classpng_1_1detail_1_1const__packed__pixel__proxy.html">00272</a>         <span class="keyword">class </span><a class="code" href="classpng_1_1detail_1_1const__packed__pixel__proxy.html">const_packed_pixel_proxy</a>
<a name="l00273"></a>00273             : <span class="keyword">public</span> <a class="code" href="classpng_1_1detail_1_1basic__packed__pixel__proxy.html">basic_packed_pixel_proxy</a>&lt; pixel, byte const&amp; &gt;
<a name="l00274"></a>00274         {
<a name="l00275"></a>00275         <span class="keyword">public</span>:
<a name="l00276"></a><a class="code" href="classpng_1_1detail_1_1const__packed__pixel__proxy.html#a3e474d45569141699d626b347aaf8d4a">00276</a>             <a class="code" href="classpng_1_1detail_1_1const__packed__pixel__proxy.html#a3e474d45569141699d626b347aaf8d4a">const_packed_pixel_proxy</a>(<a class="code" href="namespacepng.html#ac0e0e2e09bdd9a287618bfdc5f31ca52">byte</a> <span class="keyword">const</span>&amp; ref, <span class="keywordtype">size_t</span> index)
<a name="l00277"></a>00277                 : <a class="code" href="classpng_1_1detail_1_1basic__packed__pixel__proxy.html">basic_packed_pixel_proxy</a>&lt; pixel, <a class="code" href="namespacepng.html#ac0e0e2e09bdd9a287618bfdc5f31ca52">byte</a> const&amp; &gt;(ref, index)
<a name="l00278"></a>00278             {
<a name="l00279"></a>00279             }
<a name="l00280"></a>00280         };
<a name="l00281"></a>00281 
<a name="l00282"></a>00282         <span class="keyword">template</span>&lt; <span class="keyword">class</span> pixel &gt;
<a name="l00283"></a><a class="code" href="classpng_1_1detail_1_1packed__pixel__proxy.html">00283</a>         <span class="keyword">class </span><a class="code" href="classpng_1_1detail_1_1packed__pixel__proxy.html">packed_pixel_proxy</a>
<a name="l00284"></a>00284             : <span class="keyword">public</span> <a class="code" href="classpng_1_1detail_1_1basic__packed__pixel__proxy.html">basic_packed_pixel_proxy</a>&lt; pixel, byte&amp; &gt;
<a name="l00285"></a>00285         {
<a name="l00286"></a>00286         <span class="keyword">public</span>:
<a name="l00287"></a><a class="code" href="classpng_1_1detail_1_1packed__pixel__proxy.html#a02df93d7a6402a47b5a15e53e9a043ac">00287</a>             <span class="keyword">typedef</span> <a class="code" href="classpng_1_1detail_1_1basic__packed__pixel__proxy.html">basic_packed_pixel_proxy&lt; pixel, byte&amp; &gt;</a> <a class="code" href="classpng_1_1detail_1_1packed__pixel__proxy.html#a02df93d7a6402a47b5a15e53e9a043ac">basic_proxy</a>;
<a name="l00288"></a>00288 
<a name="l00289"></a><a class="code" href="classpng_1_1detail_1_1packed__pixel__proxy.html#a69df737e97bd677ca66a26c319905af7">00289</a>             <a class="code" href="classpng_1_1detail_1_1packed__pixel__proxy.html#a69df737e97bd677ca66a26c319905af7">packed_pixel_proxy</a>(<a class="code" href="namespacepng.html#ac0e0e2e09bdd9a287618bfdc5f31ca52">byte</a>&amp; ref, <span class="keywordtype">size_t</span> index)
<a name="l00290"></a>00290                 : <a class="code" href="classpng_1_1detail_1_1basic__packed__pixel__proxy.html">basic_proxy</a>(ref, index)
<a name="l00291"></a>00291             {
<a name="l00292"></a>00292             }
<a name="l00293"></a>00293 
<a name="l00294"></a><a class="code" href="classpng_1_1detail_1_1packed__pixel__proxy.html#a9ff1530c669cf35c29ba88baebe9a354">00294</a>             <a class="code" href="classpng_1_1detail_1_1packed__pixel__proxy.html#a69df737e97bd677ca66a26c319905af7">packed_pixel_proxy</a>(<a class="code" href="classpng_1_1detail_1_1packed__pixel__proxy.html">packed_pixel_proxy</a> <span class="keyword">const</span>&amp; other)
<a name="l00295"></a>00295                 : <a class="code" href="classpng_1_1detail_1_1basic__packed__pixel__proxy.html">basic_proxy</a>(other.<a class="code" href="classpng_1_1detail_1_1basic__packed__pixel__proxy.html#a0b47ef1e993ff1a0b0cd036a4775ca6a">m_ref</a>)
<a name="l00296"></a>00296             {
<a name="l00297"></a>00297                 this-&gt;<a class="code" href="classpng_1_1detail_1_1basic__packed__pixel__proxy.html#afec0eb6d13500f31e5300fcb6f5c9e8b">m_shift</a> = other.<a class="code" href="classpng_1_1detail_1_1basic__packed__pixel__proxy.html#afec0eb6d13500f31e5300fcb6f5c9e8b">m_shift</a>;
<a name="l00298"></a>00298             }
<a name="l00299"></a>00299 
<a name="l00300"></a><a class="code" href="classpng_1_1detail_1_1packed__pixel__proxy.html#a1ae2462d6f4ae3df6de180e6b9e97d22">00300</a>             <a class="code" href="classpng_1_1detail_1_1packed__pixel__proxy.html">packed_pixel_proxy</a>&amp; <a class="code" href="classpng_1_1detail_1_1packed__pixel__proxy.html#a1ae2462d6f4ae3df6de180e6b9e97d22">operator=</a>(<a class="code" href="classpng_1_1detail_1_1packed__pixel__proxy.html">packed_pixel_proxy</a> <span class="keyword">const</span>&amp; other)
<a name="l00301"></a>00301             {
<a name="l00302"></a>00302                 <span class="keywordflow">return</span> *<span class="keyword">this</span> = <span class="keyword">static_cast&lt;</span> pixel <span class="keyword">&gt;</span>(other);
<a name="l00303"></a>00303             }
<a name="l00304"></a>00304 
<a name="l00305"></a>00305             <span class="keyword">template</span>&lt; <span class="keyword">typename</span> reference &gt;
<a name="l00306"></a>00306             <a class="code" href="classpng_1_1detail_1_1packed__pixel__proxy.html">packed_pixel_proxy</a>&amp;
<a name="l00307"></a><a class="code" href="classpng_1_1detail_1_1packed__pixel__proxy.html#a2ef5e7112cc82d8974a36499c5b2a887">00307</a>             <a class="code" href="classpng_1_1detail_1_1packed__pixel__proxy.html#a1ae2462d6f4ae3df6de180e6b9e97d22">operator=</a>(<a class="code" href="classpng_1_1detail_1_1basic__packed__pixel__proxy.html">basic_packed_pixel_proxy&lt; pixel, reference &gt;</a> <span class="keyword">const</span>&amp; other)
<a name="l00308"></a>00308             {
<a name="l00309"></a>00309                 <span class="keywordflow">return</span> *<span class="keyword">this</span> = <span class="keyword">static_cast&lt;</span> pixel <span class="keyword">&gt;</span>(other);
<a name="l00310"></a>00310             }
<a name="l00311"></a>00311 
<a name="l00312"></a><a class="code" href="classpng_1_1detail_1_1packed__pixel__proxy.html#ad65d5de8b87c1fe226695d7b1fd03494">00312</a>             <a class="code" href="classpng_1_1detail_1_1packed__pixel__proxy.html">packed_pixel_proxy</a>&amp; <a class="code" href="classpng_1_1detail_1_1packed__pixel__proxy.html#a1ae2462d6f4ae3df6de180e6b9e97d22">operator=</a>(pixel p)
<a name="l00313"></a>00313             {
<a name="l00314"></a>00314                 this-&gt;<a class="code" href="classpng_1_1detail_1_1basic__packed__pixel__proxy.html#a0b47ef1e993ff1a0b0cd036a4775ca6a">m_ref</a> = (this-&gt;<a class="code" href="classpng_1_1detail_1_1basic__packed__pixel__proxy.html#a0b47ef1e993ff1a0b0cd036a4775ca6a">m_ref</a>
<a name="l00315"></a>00315                     &amp; ~(pixel::get_bit_mask() &lt;&lt; this-&gt;<a class="code" href="classpng_1_1detail_1_1basic__packed__pixel__proxy.html#afec0eb6d13500f31e5300fcb6f5c9e8b">m_shift</a>))
<a name="l00316"></a>00316                     | (p &lt;&lt; this-&gt;<a class="code" href="classpng_1_1detail_1_1basic__packed__pixel__proxy.html#afec0eb6d13500f31e5300fcb6f5c9e8b">m_shift</a>);
<a name="l00317"></a>00317 
<a name="l00318"></a>00318                 <span class="keywordflow">return</span> *<span class="keyword">this</span>;
<a name="l00319"></a>00319             }
<a name="l00320"></a>00320         };
<a name="l00321"></a>00321 
<a name="l00322"></a>00322     } <span class="comment">// namespace detail</span>
<a name="l00323"></a>00323 
<a name="l00330"></a>00330     <span class="keyword">template</span>&lt; <span class="keyword">class</span> pixel &gt;
<a name="l00331"></a><a class="code" href="classpng_1_1packed__pixel__row.html">00331</a>     <span class="keyword">class </span><a class="code" href="classpng_1_1packed__pixel__row.html" title="The packed pixel row class template.">packed_pixel_row</a>
<a name="l00332"></a>00332     {
<a name="l00333"></a>00333     <span class="keyword">public</span>:
<a name="l00337"></a><a class="code" href="classpng_1_1packed__pixel__row.html#ad09dc20d8daa8d32d240ee611be4d1b8">00337</a>         <span class="keyword">explicit</span> <a class="code" href="classpng_1_1packed__pixel__row.html#ad09dc20d8daa8d32d240ee611be4d1b8" title="Constructs a pixel row object for size packed pixels.">packed_pixel_row</a>(<span class="keywordtype">size_t</span> <a class="code" href="classpng_1_1packed__pixel__row.html#a25a90dc43dbe6fe8770fcb30f0683775">size</a> = 0)
<a name="l00338"></a>00338         {
<a name="l00339"></a>00339             <a class="code" href="classpng_1_1packed__pixel__row.html#af650107b3a1eaaefc9d491780c09c44f" title="Resizes the pixel row to hold up to size packed pixels.">resize</a>(<a class="code" href="classpng_1_1packed__pixel__row.html#a25a90dc43dbe6fe8770fcb30f0683775">size</a>);
<a name="l00340"></a>00340         }
<a name="l00341"></a>00341 
<a name="l00342"></a><a class="code" href="classpng_1_1packed__pixel__row.html#a25a90dc43dbe6fe8770fcb30f0683775">00342</a>         <span class="keywordtype">size_t</span> <a class="code" href="classpng_1_1packed__pixel__row.html#a25a90dc43dbe6fe8770fcb30f0683775">size</a>()<span class="keyword"> const</span>
<a name="l00343"></a>00343 <span class="keyword">        </span>{
<a name="l00344"></a>00344             <span class="keywordflow">return</span> m_size;
<a name="l00345"></a>00345         }
<a name="l00346"></a>00346 
<a name="l00350"></a><a class="code" href="classpng_1_1packed__pixel__row.html#af650107b3a1eaaefc9d491780c09c44f">00350</a>         <span class="keywordtype">void</span> <a class="code" href="classpng_1_1packed__pixel__row.html#af650107b3a1eaaefc9d491780c09c44f" title="Resizes the pixel row to hold up to size packed pixels.">resize</a>(<span class="keywordtype">size_t</span> <a class="code" href="classpng_1_1packed__pixel__row.html#a25a90dc43dbe6fe8770fcb30f0683775">size</a>)
<a name="l00351"></a>00351         {
<a name="l00352"></a>00352             m_vec.resize(size / get_pixels_per_byte()
<a name="l00353"></a>00353                          + (size % get_pixels_per_byte() ? 1 : 0));
<a name="l00354"></a>00354             m_size = <a class="code" href="classpng_1_1packed__pixel__row.html#a25a90dc43dbe6fe8770fcb30f0683775">size</a>;
<a name="l00355"></a>00355         }
<a name="l00356"></a>00356 
<a name="l00360"></a><a class="code" href="classpng_1_1packed__pixel__row.html#a4c0388d60842c2b6a2be299643bb3c9f">00360</a>         <span class="keyword">typedef</span> <a class="code" href="classpng_1_1detail_1_1const__packed__pixel__proxy.html">detail::const_packed_pixel_proxy&lt; pixel &gt;</a> <a class="code" href="classpng_1_1packed__pixel__row.html#a4c0388d60842c2b6a2be299643bb3c9f" title="The immutable packed pixel proxy type.">const_pixel_proxy</a>;
<a name="l00361"></a>00361 
<a name="l00365"></a><a class="code" href="classpng_1_1packed__pixel__row.html#a897495a13cbd44795072bd850e1dbce7">00365</a>         <span class="keyword">typedef</span> <a class="code" href="classpng_1_1detail_1_1packed__pixel__proxy.html">detail::packed_pixel_proxy&lt; pixel &gt;</a> <a class="code" href="classpng_1_1packed__pixel__row.html#a897495a13cbd44795072bd850e1dbce7" title="The mutable packed pixel proxy type.">pixel_proxy</a>;
<a name="l00366"></a>00366 
<a name="l00371"></a><a class="code" href="classpng_1_1packed__pixel__row.html#aadaf4feb690f1182600684c5cd5934dc">00371</a>         <a class="code" href="classpng_1_1detail_1_1const__packed__pixel__proxy.html">const_pixel_proxy</a> <a class="code" href="classpng_1_1packed__pixel__row.html#aadaf4feb690f1182600684c5cd5934dc" title="Returns an immutable proxy the to the pixel at index.">at</a>(<span class="keywordtype">size_t</span> index)<span class="keyword"> const</span>
<a name="l00372"></a>00372 <span class="keyword">        </span>{
<a name="l00373"></a>00373             <span class="keywordflow">return</span> <a class="code" href="classpng_1_1packed__pixel__row.html#a4c0388d60842c2b6a2be299643bb3c9f" title="The immutable packed pixel proxy type.">const_pixel_proxy</a>(m_vec.at(index / get_pixels_per_byte()),
<a name="l00374"></a>00374                                      index);
<a name="l00375"></a>00375         }
<a name="l00376"></a>00376 
<a name="l00381"></a><a class="code" href="classpng_1_1packed__pixel__row.html#a746483f6e57f37f56e84e0dcdca94784">00381</a>         <a class="code" href="classpng_1_1detail_1_1packed__pixel__proxy.html">pixel_proxy</a> <a class="code" href="classpng_1_1packed__pixel__row.html#aadaf4feb690f1182600684c5cd5934dc" title="Returns an immutable proxy the to the pixel at index.">at</a>(<span class="keywordtype">size_t</span> index)
<a name="l00382"></a>00382         {
<a name="l00383"></a>00383             <span class="keywordflow">return</span> <a class="code" href="classpng_1_1packed__pixel__row.html#a897495a13cbd44795072bd850e1dbce7" title="The mutable packed pixel proxy type.">pixel_proxy</a>(m_vec.at(index / get_pixels_per_byte()),
<a name="l00384"></a>00384                                index);
<a name="l00385"></a>00385         }
<a name="l00386"></a>00386 
<a name="l00391"></a><a class="code" href="classpng_1_1packed__pixel__row.html#a7cfc6e59109b4a093f8474c524fcf7e0">00391</a>         <a class="code" href="classpng_1_1detail_1_1const__packed__pixel__proxy.html">const_pixel_proxy</a> <a class="code" href="classpng_1_1packed__pixel__row.html#a7cfc6e59109b4a093f8474c524fcf7e0" title="Returns an immutable proxy the to the pixel at index. The non-checking version.">operator[]</a>(<span class="keywordtype">size_t</span> index)<span class="keyword"> const</span>
<a name="l00392"></a>00392 <span class="keyword">        </span>{
<a name="l00393"></a>00393             <span class="keywordflow">return</span> <a class="code" href="classpng_1_1packed__pixel__row.html#a4c0388d60842c2b6a2be299643bb3c9f" title="The immutable packed pixel proxy type.">const_pixel_proxy</a>(m_vec[index / get_pixels_per_byte()],
<a name="l00394"></a>00394                                      index);
<a name="l00395"></a>00395         }
<a name="l00396"></a>00396 
<a name="l00401"></a><a class="code" href="classpng_1_1packed__pixel__row.html#a180d74dc94c19b24bc9050fc8fb4debb">00401</a>         <a class="code" href="classpng_1_1detail_1_1packed__pixel__proxy.html">pixel_proxy</a> <a class="code" href="classpng_1_1packed__pixel__row.html#a7cfc6e59109b4a093f8474c524fcf7e0" title="Returns an immutable proxy the to the pixel at index. The non-checking version.">operator[]</a>(<span class="keywordtype">size_t</span> index)
<a name="l00402"></a>00402         {
<a name="l00403"></a>00403             <span class="keywordflow">return</span> <a class="code" href="classpng_1_1packed__pixel__row.html#a897495a13cbd44795072bd850e1dbce7" title="The mutable packed pixel proxy type.">pixel_proxy</a>(m_vec[index / get_pixels_per_byte()],
<a name="l00404"></a>00404                                index);
<a name="l00405"></a>00405         }
<a name="l00406"></a>00406 
<a name="l00410"></a><a class="code" href="classpng_1_1packed__pixel__row.html#a74de77e418802c2294f9f4ff8616feb5">00410</a>         <a class="code" href="namespacepng.html#ac0e0e2e09bdd9a287618bfdc5f31ca52">byte</a>* <a class="code" href="classpng_1_1packed__pixel__row.html#a74de77e418802c2294f9f4ff8616feb5" title="Returns the starting address of the row.">get_data</a>()
<a name="l00411"></a>00411         {
<a name="l00412"></a>00412             assert(m_vec.size());
<a name="l00413"></a>00413             <span class="keywordflow">return</span> &amp; m_vec[0];
<a name="l00414"></a>00414         }
<a name="l00415"></a>00415 
<a name="l00416"></a>00416     <span class="keyword">private</span>:
<a name="l00417"></a>00417         <span class="keyword">static</span> <span class="keywordtype">size_t</span> get_pixels_per_byte()
<a name="l00418"></a>00418         {
<a name="l00419"></a>00419             <span class="keywordflow">return</span> 8 / pixel::get_bit_depth();
<a name="l00420"></a>00420         }
<a name="l00421"></a>00421 
<a name="l00422"></a>00422         std::vector&lt; byte &gt; m_vec;
<a name="l00423"></a>00423         <span class="keywordtype">size_t</span> m_size;
<a name="l00424"></a>00424     };
<a name="l00425"></a>00425 
<a name="l00430"></a>00430     <span class="keyword">template</span>&lt; <span class="keyword">typename</span> pixel &gt;
<a name="l00431"></a><a class="code" href="classpng_1_1row__traits_3_01packed__pixel__row_3_01pixel_01_4_01_4.html">00431</a>     <span class="keyword">class </span>row_traits&lt; <a class="code" href="classpng_1_1packed__pixel__row.html" title="The packed pixel row class template.">packed_pixel_row</a>&lt; pixel &gt; &gt;
<a name="l00432"></a>00432     {
<a name="l00433"></a>00433     <span class="keyword">public</span>:
<a name="l00437"></a><a class="code" href="classpng_1_1row__traits_3_01packed__pixel__row_3_01pixel_01_4_01_4.html#a46c4d5d5c3207a1f16e2b7b1b0442960">00437</a>         <span class="keyword">static</span> <a class="code" href="namespacepng.html#ac0e0e2e09bdd9a287618bfdc5f31ca52">byte</a>* get_data(<a class="code" href="classpng_1_1packed__pixel__row.html" title="The packed pixel row class template.">packed_pixel_row&lt; pixel &gt;</a>&amp; row)
<a name="l00438"></a>00438         {
<a name="l00439"></a>00439             <span class="keywordflow">return</span> row.<a class="code" href="classpng_1_1packed__pixel__row.html#a74de77e418802c2294f9f4ff8616feb5" title="Returns the starting address of the row.">get_data</a>();
<a name="l00440"></a>00440         }
<a name="l00441"></a>00441     };
<a name="l00442"></a>00442 
<a name="l00447"></a>00447     <span class="keyword">template</span>&lt; <span class="keywordtype">size_t</span> bits &gt;
<a name="l00448"></a><a class="code" href="classpng_1_1pixel__buffer_3_01packed__gray__pixel_3_01bits_01_4_01_4.html">00448</a>     <span class="keyword">class </span><a class="code" href="classpng_1_1pixel__buffer.html">pixel_buffer</a>&lt; <a class="code" href="classpng_1_1packed__gray__pixel.html" title="The packed gray pixel class template. The available specializations are for 1-, 2- and 4-bit pixels...">packed_gray_pixel</a>&lt; bits &gt; &gt;
<a name="l00449"></a>00449         : <span class="keyword">public</span> <a class="code" href="classpng_1_1basic__pixel__buffer.html" title="The basic class template to represent image pixel data.">basic_pixel_buffer</a>&lt; packed_gray_pixel&lt; bits &gt;,
<a name="l00450"></a>00450                                      packed_pixel_row&lt; packed_gray_pixel
<a name="l00451"></a>00451                                                        &lt; bits &gt; &gt; &gt;
<a name="l00452"></a>00452     {
<a name="l00453"></a>00453     <span class="keyword">public</span>:
<a name="l00454"></a><a class="code" href="classpng_1_1pixel__buffer_3_01packed__gray__pixel_3_01bits_01_4_01_4.html#a9889ffa423eb65525aeb745fdd500542">00454</a>         <span class="keyword">typedef</span> <a class="code" href="classpng_1_1packed__gray__pixel.html" title="The packed gray pixel class template. The available specializations are for 1-, 2- and 4-bit pixels...">packed_gray_pixel&lt; bits &gt;</a> <a class="code" href="classpng_1_1pixel__buffer_3_01packed__gray__pixel_3_01bits_01_4_01_4.html#a9889ffa423eb65525aeb745fdd500542">pixel_type</a>;
<a name="l00455"></a><a class="code" href="classpng_1_1pixel__buffer_3_01packed__gray__pixel_3_01bits_01_4_01_4.html#ab1b7e1fffdae0f6fe996502720dcc43b">00455</a>         <span class="keyword">typedef</span> <a class="code" href="classpng_1_1packed__pixel__row.html" title="The packed pixel row class template.">packed_pixel_row&lt; pixel_type &gt;</a> <a class="code" href="classpng_1_1pixel__buffer_3_01packed__gray__pixel_3_01bits_01_4_01_4.html#ab1b7e1fffdae0f6fe996502720dcc43b">pixel_row_type</a>;
<a name="l00456"></a>00456 
<a name="l00457"></a><a class="code" href="classpng_1_1pixel__buffer_3_01packed__gray__pixel_3_01bits_01_4_01_4.html#ab577291f34ee9dba065b252e48a0483a">00457</a>         <a class="code" href="classpng_1_1pixel__buffer.html#a2f6ce8ebf423720f5956630b1fa930ac">pixel_buffer</a>()
<a name="l00458"></a>00458         {
<a name="l00459"></a>00459         }
<a name="l00460"></a>00460 
<a name="l00461"></a><a class="code" href="classpng_1_1pixel__buffer_3_01packed__gray__pixel_3_01bits_01_4_01_4.html#aa2e03d4df0e282f1c1b5352365bcf1b3">00461</a>         <a class="code" href="classpng_1_1pixel__buffer.html#a2f6ce8ebf423720f5956630b1fa930ac">pixel_buffer</a>(<span class="keywordtype">size_t</span> width, <span class="keywordtype">size_t</span> height)
<a name="l00462"></a>00462             : <a class="code" href="classpng_1_1basic__pixel__buffer.html" title="The basic class template to represent image pixel data.">basic_pixel_buffer</a>&lt; <a class="code" href="classpng_1_1packed__gray__pixel.html" title="The packed gray pixel class template. The available specializations are for 1-, 2- and 4-bit pixels...">pixel_type</a>,
<a name="l00463"></a>00463                                   <a class="code" href="classpng_1_1packed__pixel__row.html" title="The packed pixel row class template.">pixel_row_type</a> &gt;(width, height)
<a name="l00464"></a>00464         {
<a name="l00465"></a>00465         }
<a name="l00466"></a>00466     };
<a name="l00467"></a>00467 
<a name="l00472"></a>00472     <span class="keyword">template</span>&lt; <span class="keywordtype">size_t</span> bits &gt;
<a name="l00473"></a><a class="code" href="classpng_1_1pixel__buffer_3_01packed__index__pixel_3_01bits_01_4_01_4.html">00473</a>     <span class="keyword">class </span><a class="code" href="classpng_1_1pixel__buffer.html">pixel_buffer</a>&lt; <a class="code" href="classpng_1_1packed__index__pixel.html" title="The packed indexed pixel class template. The available specializations are for 1-, 2- and 4-bit pixels.">packed_index_pixel</a>&lt; bits &gt; &gt;
<a name="l00474"></a>00474         : <span class="keyword">public</span> <a class="code" href="classpng_1_1basic__pixel__buffer.html" title="The basic class template to represent image pixel data.">basic_pixel_buffer</a>&lt; packed_index_pixel&lt; bits &gt;,
<a name="l00475"></a>00475                                      packed_pixel_row&lt; packed_index_pixel
<a name="l00476"></a>00476                                                        &lt; bits &gt; &gt; &gt;
<a name="l00477"></a>00477     {
<a name="l00478"></a>00478     <span class="keyword">public</span>:
<a name="l00479"></a><a class="code" href="classpng_1_1pixel__buffer_3_01packed__index__pixel_3_01bits_01_4_01_4.html#a8a023a38d67e7cbd7aa2791eda00c9e6">00479</a>         <span class="keyword">typedef</span> <a class="code" href="classpng_1_1packed__index__pixel.html" title="The packed indexed pixel class template. The available specializations are for 1-, 2- and 4-bit pixels.">packed_index_pixel&lt; bits &gt;</a> <a class="code" href="classpng_1_1pixel__buffer_3_01packed__index__pixel_3_01bits_01_4_01_4.html#a8a023a38d67e7cbd7aa2791eda00c9e6">pixel_type</a>;
<a name="l00480"></a><a class="code" href="classpng_1_1pixel__buffer_3_01packed__index__pixel_3_01bits_01_4_01_4.html#a44a916eca6ff8ad420f6d3a3a41e769a">00480</a>         <span class="keyword">typedef</span> <a class="code" href="classpng_1_1packed__pixel__row.html" title="The packed pixel row class template.">packed_pixel_row&lt; pixel_type &gt;</a> <a class="code" href="classpng_1_1pixel__buffer_3_01packed__index__pixel_3_01bits_01_4_01_4.html#a44a916eca6ff8ad420f6d3a3a41e769a">pixel_row_type</a>;
<a name="l00481"></a>00481 
<a name="l00482"></a><a class="code" href="classpng_1_1pixel__buffer_3_01packed__index__pixel_3_01bits_01_4_01_4.html#ad49b317d287fb0952132a8aab32a8f8b">00482</a>         <a class="code" href="classpng_1_1pixel__buffer.html#a2f6ce8ebf423720f5956630b1fa930ac">pixel_buffer</a>()
<a name="l00483"></a>00483         {
<a name="l00484"></a>00484         }
<a name="l00485"></a>00485 
<a name="l00486"></a><a class="code" href="classpng_1_1pixel__buffer_3_01packed__index__pixel_3_01bits_01_4_01_4.html#ae80859aa225ca100ff31f5da70977b48">00486</a>         <a class="code" href="classpng_1_1pixel__buffer.html#a2f6ce8ebf423720f5956630b1fa930ac">pixel_buffer</a>(<span class="keywordtype">size_t</span> width, <span class="keywordtype">size_t</span> height)
<a name="l00487"></a>00487             : <a class="code" href="classpng_1_1basic__pixel__buffer.html" title="The basic class template to represent image pixel data.">basic_pixel_buffer</a>&lt; <a class="code" href="classpng_1_1packed__index__pixel.html" title="The packed indexed pixel class template. The available specializations are for 1-, 2- and 4-bit pixels.">pixel_type</a>,
<a name="l00488"></a>00488                                   <a class="code" href="classpng_1_1packed__pixel__row.html" title="The packed pixel row class template.">pixel_row_type</a> &gt;(width, height)
<a name="l00489"></a>00489         {
<a name="l00490"></a>00490         }
<a name="l00491"></a>00491     };
<a name="l00492"></a>00492 
<a name="l00493"></a>00493 } <span class="comment">// namespace png</span>
<a name="l00494"></a>00494 
<a name="l00495"></a>00495 <span class="preprocessor">#endif // PNGPP_PIXEL_BUFFER_HPP_INCLUDED</span>
</pre></div></div><!-- contents -->


<hr class="footer"/><address class="footer"><small>
Generated on Fri Jan 25 2013 14:10:10 for png++ by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>

</body>
</html>
